#!/usr/bin/env python
# -*- coding: utf-8 -*-
import gtk
import gettext
_ = gettext.gettext
class TextEntryDialog(gtk.MessageDialog):
    def __init__(self):
        super(TextEntryDialog, self).__init__(
            None,
            gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
            gtk.MESSAGE_INFO,
            gtk.BUTTONS_OK,
            None
        )
        super(TextEntryDialog, self).set_markup(_('Please paste the <b>url</b> to download:'))
        hbox = gtk.HBox()
        self.entry = gtk.Entry()
        self.entry.connect("activate", self.responseToDialog, gtk.RESPONSE_OK)
        hbox.pack_start(gtk.Label(_("Url:")), False, 5, 5)
        hbox.pack_end(self.entry)
        super(TextEntryDialog, self).vbox.pack_end(hbox, True, True, 0)
        super(TextEntryDialog, self).show_all()
 
    def responseToDialog(self, entry, response):
        super(TextEntryDialog, self).response(response)
 
    def run(self):
        super(TextEntryDialog, self).run()
        text = self.entry.get_text()
        return text
        
